using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

public partial class MasterPage : System.Web.UI.MasterPage
{
    CategoryDAO daoCate = new CategoryDAO();
    protected void Page_Load(object sender, EventArgs e)
    {
        lblOnline.Text=Application["onlinenum"].ToString();
        if ((bool)Session["logedin"])
        {
            lblUser.Text = Session["user"].ToString();
            lnkLogin.Text = "Log out";
        }
        else { lblUser.Text = "Guest"; }
        IList<BookCategory> cates = daoCate.GetAll();
        rptCategory.DataSource = cates;
        rptCategory.DataBind();
    }
    protected void Page_Unload(object sender, EventArgs e)
    {
        //Session.Clear();
       // Session.Abandon();
        
    }


    protected void lnkLogin_Click(object sender, EventArgs e)
    {
        if ((bool)Session["logedin"] == false)
            Response.Redirect("login.aspx");
        else
        {
            Response.Redirect("Signout.aspx");
        }
    }
    protected void lnkHome_Click(object sender, EventArgs e)
    {
        Response.Redirect("Index.aspx");
    }
}
